//valueOf 与 toString 的调用问题探索
class A{
    valueOf(){
        console.log('valueOf');
        return 2;
    }
    toString(){
        console.log('toString');
        return 'hello';
    }
}

var a = new A();

console.log(String(a));
console.log(Number(a));
console.log(a+2);
console.log(a+'22');
console.log(a==2);